define(['app', 'angularAMD', 'angular', '$rootScope'], function (app, angularAMD, angular, $rootScope) {
    configBaseView.$inject = ['$stateProvider', '$urlRouterProvider', 'pathPrefix', '$controllerProvider'];

    function configBaseView($stateProvider, $urlRouterProvider, pathPrefix, $controllerProvider) {
        var managerPath = pathPrefix + 'components/manager';
        $stateProvider.state('manager', {
            'abstract': true,
            url: '/manager',
            templateUrl: managerPath + '/main.html',
            resolve: {
                directive: function ($q) {
                    var defer = $q.defer()
                    require(['ngload!angular-chosen', 'root/components/common/toaster', 'root/components/common/modal/modal',
                        'ngload!angular-toggle-switch', 'jquery-form'], function () {
                        defer.resolve()
                    })
                    return defer.promise
                }
            }
        });
        if ($rootScope.$user.type == 2) {//学校管理员
            // 团员信息采集设置
            $stateProvider.state('manager.tyxxcjsz', {
                url: '/tyxxcjsz',
                parent: 'manager',
                templateUrl: managerPath + '/tyxxcjsz.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/time/datetimepicker'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            //团员信息审核
            $stateProvider.state('manager.tyxxcjAudit', {
                url: '/tyxxcjAudit',
                parent: 'manager',
                templateUrl: managerPath + '/tyxxcjAuditMain.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/toaster', 'root/components/common/time/datetimepicker',
                            'root/components/common/upload/upload'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            // 团情统计设置
            $stateProvider.state('manager.tqtjsz', {
                url: '/tqtjsz',
                parent: 'manager',
                templateUrl: managerPath + '/tqtjsz.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/time/datetimepicker'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            // 团情统计管理
            $stateProvider.state('manager.tqtjgl', {
                url: '/tqtjgl',
                parent: 'manager',
                templateUrl: managerPath + '/tqtjgl.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/time/datetimepicker'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            // 用户管理
            $stateProvider.state('manager.admin', {
                url: '/admin',
                parent: 'manager',
                templateUrl: managerPath + '/admin.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/time/datetimepicker'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            // 默认路由到团员信息采集设置
            $urlRouterProvider.when('/manager', '/manager/tyxxcjAudit');
        } else if ($rootScope.$user.type == 1) {//院系管理员
            //团组织管理
            $stateProvider.state('manager.tzzgl', {
                url: '/tzzgl',
                parent: 'manager',
                templateUrl: managerPath + '/tzzgl.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/toaster', 'root/components/common/time/datetimepicker',
                            'root/components/common/upload/upload'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            //团干部管理
            $stateProvider.state('manager.tgbgl', {
                //团干部管理
                url: '/tgbgl',
                parent: 'manager',
                templateUrl: managerPath + '/tgbgl.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/toaster', 'root/components/common/time/datetimepicker',
                            'root/components/common/upload/upload'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            //团员信息审核
            $stateProvider.state('manager.tyxxcjAudit', {
                url: '/tyxxcjAudit',
                parent: 'manager',
                templateUrl: managerPath + '/tyxxcjAuditMain.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/toaster', 'root/components/common/time/datetimepicker',
                            'root/components/common/upload/upload'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            // 默认路由到期次维护
            $urlRouterProvider.when('/manager', '/manager/tzzgl');
        } else if ($rootScope.$user.type == 4) {//支部管理员
            //团员信息采集
            $stateProvider.state('manager.tyxxcj', {
                url: '/tyxxcj',
                parent: 'manager',
                templateUrl: managerPath + '/tyxxcjMain.html',
                resolve: {
                    directive: function ($q) {
                        var defer = $q.defer()
                        require(['root/components/common/toaster', 'root/components/common/time/datetimepicker',
                            'root/components/common/upload/upload'], function () {
                            defer.resolve()
                        })
                        return defer.promise
                    }
                }
            });
            // 默认路由到期次维护
            $urlRouterProvider.when('/manager', '/manager/tyxxcj');
        }

    }

    angularAMD.config(configBaseView);
});